// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 .
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : apb_transaction.sv
// Author        : 
// Created On    : 2022-08-25 14:42
// Last Modified : 
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------

`ifndef __APB_TRANSACTION_SV__
`define __APB_TRANSACTION_SV__

class apb_transaction extends uvm_sequence_item;

    typedef enum {READ,WRITE} op_kind;

    rand op_kind       kind;
    rand bit [32 -1:0] data;
    rand bit [48 -1:0] addr;
    rand bit [4  -1:0] strb;
    rand int           cycle_post;
    
    `uvm_object_utils_begin(apb_transaction)
        `uvm_field_int(data, UVM_ALL_ON)
        `uvm_field_int(addr, UVM_ALL_ON)
        `uvm_field_enum(op_kind, kind, UVM_ALL_ON)
    `uvm_object_utils_end

    extern constraint data_cons;
    extern constraint addr_cons;
    extern constraint kind_cons;
    extern constraint cycle_post_cons;
    
    extern function new(string name = "apb_transaction");
	extern virtual function void pack();
	extern virtual function void unpack();
	
endclass: apb_transaction

constraint apb_transaction::data_cons{
}
constraint apb_transaction::addr_cons{
}
constraint apb_transaction::kind_cons{
}
constraint apb_transaction::cycle_post_cons{
    cycle_post dist {0:/30, [1:10]:/30, [10:20]:/30};
}

function apb_transaction::new(string name = "apb_transaction");
	super.new(name);
endfunction

function void apb_transaction::pack();
endfunction: pack

function void apb_transaction::unpack();
endfunction: unpack

`endif
